<template>
    <div>
        <h1>管理员登录</h1>
        <table class="table">
            <tr>
                <td>账号</td>
                <td><input type="text" v-model="data.name"></td>
            </tr>
            <tr>
                <td>密码</td>
                <td><input type="password" v-model="data.pwd"></td>
            </tr>
            <tr>
                <td></td>
                <td><input type="button" value="登录" @click="dl"></td>
            </tr>
        </table>
    </div>
</template>

<script setup lang="ts">
import axios from 'axios'
import {ref,onMounted} from 'vue'
import {useRouter,useRoute} from 'vue-router'
import moment from 'moment'
import { ListFormat } from 'typescript';
const router=useRouter();
const route=useRoute();
const data=ref({
    name:"",
    pwd:""
})
const dl=()=>{
    axios.get("/api/Login/Logins",{params:data.value}).then(res=>{
        if(res.data.uid==-1){
            alert("用户名不存在")
            return
        }
        if(res.data.uid==-2){
            alert("密码错误")
            return
        }
        if(res.data.uid>0){
            alert("登录成功")
            router.push({path:"/bshow"})
            
        }
    })
}
</script>

<style scoped>

</style>